<template>
	<view class="main_content" v-if="items.length > 0">
		<!-- <view class="product" v-for="(item, index) in items" :key="index"> -->
		<!-- <text class="product_spotName">{{ item.spotName }}</text> -->
		<!-- <text class="product_spotIntro">{{ item.spotIntro}}</text> -->
		<!-- <image class="product_imgUrl" :src="item.imgUrl"></image> -->
		<!-- 	<view class="product_imgUrl1">
				<image v-for="(imgUrl, imgIndex) in item.imgUrls" :key="imgIndex" :src="imgUrl" class="image"
					mode="aspectFill"></image>
			</view>
		</view> -->
		<view class="product">
			<!-- <rich-text class="product_spotPlan" >{{item1.spotPlan}}</rich-text> -->
			<!-- <rich-text :nodes="item1.spotPlan" class="product_spotPlan"></rich-text> -->
			<rich-text :nodes="item1.spotPlan"></rich-text>
		</view>

	</view>

	<!-- uni.getStorageSync('state')  0--业务员 1是用户-->
</template>

<script>
	import {
		mapState
	} from 'pinia'
	import {
		useUserInfoStore
	} from '../../../stores/userInfo.js'
	import {
		isBindAgentAPI
	} from '../../../api/common.js';
	export default {
		props: {
			item1: {
				type: Object,

			},
		},
		name: 'arrange',
		data() {
			return {
				items: [], // 存放从后端拿的数据数据
			};
		},
		computed: {
			...mapState(useUserInfoStore, ['id', 'phone', 'username', 'state'])
		},
		mounted() {
			this.fetchProductList(); // 页面加载时调用获取商品列表的方法
		},
		methods: {
			fetchProductList() {
				uni.request({
					url: '/api/common/listAll', // 后端接口地址
					method: 'GET',
					success: (res) => {
						// console.log('旅游数据：', res.data);
						this.items = res.data.data.map(item => ({
							...item, // 复制其他所有属性  
							imgUrls: item.imgUrl ? item.imgUrl.split(' ') :
						[], 
						}));
						
					},
					fail: (err) => {
						console.error('请求失败：', err);
					}
				});
			},
			async navigateToFillInfo(id) {
				// id= id || '6043cb5b8c46e3806c34ccb84e05a9e8'
				let { data } = await isBindAgentAPI(id);
				if (data === null || data === "") {
				 uni.showModal({
				           title: '提示',
				           content: '请联系业务员扫码报名',
				         });
				} else {
				  const isBound = await isBindAgentAPI();
				  if (isBound) {
				    uni.navigateTo({
				    	url: '/pages/user/fillInfo/fillInfo'
				    });
				  }
				}
				
				
			}
		}
	};
</script>

<style scoped>
    .main_content {
            border: 1px solid whitesmoke;
            border-width: 1px 10px;
            display: flex;
            flex-direction: column;
            padding: 15px;
            box-sizing: border-box;
        }
    
        .product {
            padding: 10px;
            width: 100%;
        }
    
        .rich-text-container {
            width: 100%;
            word-break: break-word;
            white-space: pre-wrap;
            overflow: hidden;
            font-size: 28rpx;
            color: black;
            line-height: 1.2;
        }

    .product_spotName {
        font-size: 33rpx;
        font-weight: bold;
        margin-bottom: 3px;
        width: 800rpx;
        float: left;
    }

    .product_spotPlan {
        color: darkgray;
        font-size: 28rpx;
        width: 600rpx;
        float: left;
        padding-top: 2px;
    }

    .main_content text {
        margin-bottom: 3px;
    }

    .main_content image {
        width: 130px;
        height: 100px;
        border-radius: 5px;
        margin-right: 10px;
        margin-top: 5px;
        display: flexbox;
    }

    .main_content view {
        /* margin-bottom: 10px; */
    }
</style>